package org.example.wikwok.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.example.wikwok.pojo.Secondary_Comment;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface Secondary_CommentMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Secondary_Comment record);

    int insertSelective(Secondary_Comment record);

    Secondary_Comment selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Secondary_Comment record);

    int updateByPrimaryKeyWithBLOBs(Secondary_Comment record);

    int updateByPrimaryKey(Secondary_Comment record);

    @Select("SELECT * FROM secondary_comment WHERE commentId = #{commentId}")
    List<Secondary_Comment> selectByCommentId(Integer commentId);
    @Delete("DELETE FROM secondary_comment WHERE commentId = #{commentId}")
    void deleteByCommentId(Integer commentId);
    @Select("SELECT COUNT(*) FROM secondary_comment WHERE commentId in (SELECT id FROM comment WHERE videoId = #{videoId})")
    int selectByVideoId(Integer videoId);
    @Delete("DELETE FROM secondary_comment WHERE commentId in (SELECT id FROM comment WHERE videoId = #{videoId});")
    void deleteByVideoId(Integer videoId);
}